package com.demo.util;

import org.springframework.util.Assert;

import com.demo.enums.DataSourceEnum;

public class CustomerContextHolder {

   private static final ThreadLocal<DataSourceEnum> contextHolder = new ThreadLocal<DataSourceEnum>();
	
   public static void setDataSource(DataSourceEnum dataSourceEnum) {
      Assert.notNull(dataSourceEnum, "DataSourceEnum cannot be null");
      contextHolder.set(dataSourceEnum);
   }

   public static DataSourceEnum getDataSource() {
      return (DataSourceEnum) contextHolder.get();
   }

   public static void clearDataSourceEnum() {
      contextHolder.remove();
   }
}